package cn.crdeng.frametest.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;

@Configuration
public class swagger3Config {

    @Bean
    Docket docket() {
        //选择版本3
        return new Docket(DocumentationType.OAS_30)
                //选择生成的接口文档
                .select()
                //包所在的路径
                .apis(RequestHandlerSelectors.basePackage("cn.crdeng.frametest.subject.controller"))
                //默认报下所有的接口都生成
                .paths(PathSelectors.any())
                .build()
                .groupName("主体")
                //接口文档初始化
                .apiInfo(apiInfo());
    }

    private ApiInfo apiInfo() {
        return new ApiInfoBuilder()
                .description("crdeng测试")
                .contact(new Contact("crdeng", null, "2495988443@qq.com"))
                .version("1.0")
                .title("crdeng test")
                .build();
    }
}
